package com.ase.singleton.single;

/**
 * @author gyhstart
 * @create 2021/3/6 - 11:44
 **/
public class jatest {
    public static void main(String[] args) {
//        System.out.println("Math.round(-1.5) = " + Math.round(-1.5));
//
//        String str1 = "abcd";
//        String str2 = "abcd";
//        String str3 = new String("abcd");
//        String str4 = new String("abcd");
//        System.out.println(str1==str2);//true地址一样
//        System.out.println(str3==str4);//false,但地址不一样
//        System.out.println(str3.equals(str3));//true,值一样
//        System.out.println(str2.equals(str3));//true,值一样
//        System.out.println((str1+"a")==(str2+"a"));//false;进行了+连接地址不一样

        System.out.println("charAtReverse(new String(\"qwer\")) = " + charAtReverse(new String("qwer")));
    }

    public static String charAtReverse (String s){
        int length = s.length();
        String reverse = " ";
        for (int i = 0; i < length; i++) {
            reverse = s.charAt(i)+reverse;//字符串中获取单个字符的字符的放法
            System.out.println("s.charAt(i) = " + s.charAt(i));
        }
        return reverse;
    }

}
